package com.mine.collections;

import org.junit.Test;

import java.util.*;

/**
 * TODO
 *
 * @author wangtonggui
 * @version 1.0.0
 * @since 2021/11/17 16:53
 */
public class CollectionsDemos {
    @Test
    public void aa() {
        List<String> list = new ArrayList<>();
        list.add("1");
        System.out.println(list);
        List<String> list1 = Collections.unmodifiableList(list);
//    list1.add("2");
        System.out.println(list1);
    }

    @Test
    public void shuffle() {
        LinkedList<String> list = new LinkedList<>();
        list.add("1");
        list.add("2");
        list.add("3");
        list.add("4");
        list.add("5");
        list.add("6");
        Random random = new Random(4);
        Collections.shuffle(list, random);
        System.out.println(list);
        System.out.println(list.poll());
    }
}
